package ${package};

import java.util.Arrays;
import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lazyframework.commons.support.PageInfo;
import com.lazyframework.commons.support.Pageable;
<#assign entity="${domainObj}">
<#assign model="${domainObj + 'Model'}">
<#assign form="${domainObj + 'Form'}">
<#assign mapper="${domainObj + 'Mapper'}">
<#assign service="${domainObj + 'Service'}">
import ${basePackage}.entity.${module}.${entity};
import ${basePackage}.mapper.${module}.${mapper};
import ${basePackage}.web.${module}.form.${form};
import ${basePackage}.model.${module}.${model};
import ${basePackage}.service.${module}.${service};

/**
 * ${comment}Service实现类
 *
 * Create by lazy in ${.now?string("yyyy/MM/dd")}
 */
@Service
public class ${clsName} extends ServiceImpl<${mapper}, ${entity}> implements ${service} {

    @Override
    public boolean insert(${form} form) {
        return save(convert(form, ${entity}.class));
    }

    @Override
    public boolean deleteByIds(String ids) {
        if (StringUtils.isNotBlank(ids)) {
            return removeByIds(Arrays.asList(ids.split(",")));
        }
        return false;
    }

    @Override
    public boolean update(${form} form) {
        return updateById(convert(form, ${entity}.class));
    }

    @Override
    public ${model} findById(String id) {
        return convert(getById(id), ${model}.class);
    }

    @Override
    public List<${model}> listAll() {
        return (List<${model}>) convert(list(), ${model}.class);
    }

    @Override
    public PageInfo<${model}> listPage(Pageable pageable) {
        Page<${entity}> page = PageHelper
                .startPage(pageable.getPage(), pageable.getSize())
                .setOrderBy(pageable.getSort()).doSelectPage(() -> list(Wrappers.lambdaQuery()));
        return convert(page, ${model}.class);
    }
}
